#ifndef TCPSERVER_H
#define TCPSERVER_H

#include "workthread.h"
#include <QList>
#include <QTcpServer>

class TcpServer : public QTcpServer {
  Q_OBJECT
public:
  TcpServer(QObject *parent);

  /**
   * @brief 当有新的客户端连接的时候，自动被调用，
   * @param handle 客户端对应的套接字
   */
  virtual void incomingConnection(qintptr handle) override;
  void sendData(const QByteArray &arr);
  void closeServer();

private slots:
  void onThreadStoped(WorkThread *th);

public:
  QList<WorkThread *> m_workThreadList;
};

#endif // TCPSERVER_H
